home *** CD-ROM | disk | FTP | other *** search
- /* UUDecode.thor · by Troels Walsted Hansen
- ** $VER: UUDecode.thor v1.31 (19.03.94)
- **
- ** An ARexx script that uudecodes the file(s) contained in the
- ** message currently displayed in Thor. Utilises uuOut by Nicolas
- ** Dade.
- **
- ** Known to work with uuOut v1.03.
- */
-
- /* some user varibles. edit to your hearts content */
-
- tmpdir = "T:" /* Work dir for the decoding */
-
- /* this is where the action begins.. */
-
- options results
-
- if(substr(address(),1,4) ~= "THOR") then do
- parse arg portname
- if~(show(p, portname)) then do
- if ~(show(p, "THOR.01")) then do
- say "No THOR port found!"
- exit
- end
- else portname = "THOR.01"
- end
- end
- else portname = address()
-
- address(portname)
-
- if ~show(l, 'rexxsupport.library') then do
- if ~addlib('rexxsupport.library', 0, -30) then do
- say "Please install rexxsupport.library in your libs: directory"
- exit
- end
- end
-
- /* main stuff */
-
- GETGLOBALCONFIG
- SAVEMESSAGE CURRENT FILENAME tmpdir"Message.uu"
-
- if ~exists(tmpdir"Message.uu") then do
- REQUESTNOTIFY TEXT '"Message containing uuencoded file not saved correctly."' BT '"_Ok"'
- exit
- end
-
- address command "uuOut >"||tmpdir||"UUError "||tmpdir||"Message.uu OUTPATH="||GLOBALCONFIG.DOWNLOADPATH||" USEBASENAME"
- address(portname)
-
- open(errfile, tmpdir"UUError", R)
- str = readln(errfile)
- close(errfile)
-
- if(pos("uuOut: WARNING, EOF was reached without ever finding a 'begin' line!", str) ~= 0) then
- REQUESTNOTIFY TEXT '"Message does not contain uuencoded data."' BT '"_Ok"'
-
- /* cleanup and exit */
-
- call delete(tmpdir"UUError")
- call delete(tmpdir"Message.uu")
- exit
-